﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace translator
{
    /// <summary>
    /// CreateDBWindow.xaml 的交互逻辑
    /// </summary>

    
    public partial class CreateDBWindow : Window
    {
        CreateDBFromCurrentCommand createDBFromCurrentCommand;
        List<string> lst;
        public CreateDBWindow(CreateDBFromCurrentCommand createDBFromCurrentCommand,Lang original)
        {
            
            this.createDBFromCurrentCommand = createDBFromCurrentCommand;  
            ResizeMode = ResizeMode.NoResize;
            InitializeComponent();
            /*
            Dictionary<int, string> dicItem = new Dictionary<int, string>();
            int t = 1;
            foreach (Lang lang in Enum.GetValues(typeof(Lang)))
            {
                dicItem.Add(t, lang.ToString());
                t++;
            }*/
            lst = new List<string>(); 
            foreach (Lang lang in Enum.GetValues(typeof(Lang)))
            {
                lst.Add(lang.ToString());
            }
            TransBox.ItemsSource = lst;
            TransBox.SelectedIndex = 0;
            this.Ori.Content = original.ToString();
            this.Visibility = Visibility.Visible;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }


        private void Window_Closed(object sender, EventArgs e)
        {
            createDBFromCurrentCommand.Cancel();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Lang trans = Const.ToEnum<Lang>(TransBox.SelectedItem as string);
            createDBFromCurrentCommand.NewStringTableFromCurrentStringTable(trans, createDBFromCurrentCommand.filName);
            this.Close();
        }
    }

}
